#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    move(0,0);
    ui->setupUi(this);
    ui->lcdNumber->display(QString().setNum(num));
    timer = new QTimer(this);
    connect(timer,&QTimer::timeout,this,&Widget::timeHandle);
    timer->start(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::timeHandle()
{
    if(num == 0)
    {
        timer->stop();
        return;
    }
    ui->lcdNumber->display(QString().setNum(--num));
}

